<?php

namespace app\admin\model;

use think\Model;

/**
 * Other
 */
class Other extends Model
{
    // 表名
    protected $name = 'other';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    protected $updateTime = false;


    public function getMoneyAttr($value): float
    {
        return (float)$value;
    }

    public function getImagesAttr($value): array
    {
        if ($value === '' || $value === null) return [];
        if (!is_array($value)) {
            $value =  explode(',', $value);
            foreach ($value as &$val){
                $val = full_url($val);
            }
        }
        return $value;
    }

    public function setImagesAttr($value): string
    {
        return is_array($value) ? implode(',', $value) : $value;
    }
}
